﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 属性
{
    //客户端代码
    public class Program
    {
        static void Main()
        {
            // 创建 Person 类的实例
            Person person = new Person();

            // 使用属性设置私有字段的值
            person.FirstName = "张三";

            // 使用属性获取私有字段的值
            string name = person.FirstName;

            // 输出名字
            Console.WriteLine("姓名: " + name);

            Console.WriteLine("------------例1-------------");
            Example1 example1 = new Example1();
            Console.WriteLine(example1.FirstName);
            example1.FirstName = "zhangsan";
            Console.WriteLine(example1.FirstName);
            example1.FirstName = "lisi";
            Console.WriteLine(example1.FirstName);
            


            Console.WriteLine("------------例2-------------");
            Example2 example2 =new Example2("zhang","san");
            Console.WriteLine(example2.FirstName);
            Console.WriteLine(example2.LastName);
            Console.WriteLine(example2.FullName);
            Console.ReadKey();
        }
    }
}
